package cc.comac.mom.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cc.comac.mom.api.EquipInWarehouseSpareRelationService;
import cc.comac.mom.bean.EquipInWarehouseSpareRelation;
import cc.comac.mom.bean.ResultDev;
import cc.comac.mom.entity.EquipInWarehouseSpareRelationEntity;
import cc.comac.mom.util.ResultBean;

@RestController
@RequestMapping("/EquipInWarehouseSpareRelation")
public class EquipInWarehouseSpareRelationController {

	@Autowired
	private EquipInWarehouseSpareRelationService equipInWarehouseSpareRelationService;
	
	@RequestMapping(value = "/selectBySomeField",method = RequestMethod.POST)
	public ResultBean selectBySomeField(@RequestBody EquipInWarehouseSpareRelation equipInWarehouseSpareRelation) {
		ResultBean resultBean = new ResultBean(true);
		try {
			ResultDev selectBySomeField = equipInWarehouseSpareRelationService.selectBySomeField(equipInWarehouseSpareRelation);
			resultBean.setObject(selectBySomeField);
		} catch (RuntimeException e) {
			resultBean.setErrorMessge(e.getMessage());
			return resultBean;
		}
		return resultBean;
	}
	
	@RequestMapping(value = "/batchDelete",method = RequestMethod.POST)
	public ResultBean batchDelete(@RequestBody List<EquipInWarehouseSpareRelationEntity> list) {
			ResultBean resultBean = equipInWarehouseSpareRelationService.batchDelete(list);
		return resultBean;
	}
}
